PROJECTENGRAM

BIG-O NOTATION

Big-O Notation

Tags: #◇CCDSALG #◇Algorithms #◇Computer Science #◇Computational Complexity #◇Efficiency #◇Algorithm Design Paradigms #◇Data Structures #◇Time Complexity #◇Space Complexity


◇Overview

f(n) = O(g(n)) means f(n) grows no faster than g(n).

◇Details / Theory

Asymptotic Upper Bound.

f(n) = O(g(n)) means f(n) grows no faster than g(n). It represents the Worst-case running time of the algorithm. Formal Definition: O(g(n)) = { f(n) | ∃ c > 0, n₀ > 0 such that 0 ≤ f(n) ≤ c⋅g(n) for all n ≥ n₀ } (Handout 03, Page 3)
Example: 6n³ + 2n² + 3n + 8 is O(n³). Also O(n⁴), O(2ⁿ), etc. We usually seek the tightest un-nested loops are a fundamental control structure where one loop is contained within another. They are particularly important in frequency counting because they often represent the most computationally expensive parts of algorithms.
Is the function also O(n4)O(n^4)? How about O(n6)O(n^6)?
Yes, since the function grows no faster than n4n^4 and n6n^6
The function is O(nc),c≥3O(n^c),c≥3

◇Complexity

OperationTimeSpace

◇Common Pitfalls

Thinking O(n)O(n) always means exactly nn operations — it means at most proportional to nn. Forgetting that Big-O gives an upper bound, not a tight bound — O(n4)O(n^4) is technically correct for a Θ(n)\Theta(n) algorithm.

◇Summary

TL;DR — Big-O (OO) gives an asymptotic upper bound: f(n)=O(g(n))f(n) = O(g(n)) means f(n)f(n) grows no faster than g(n)g(n). It represents the worst-case growth rate.

Related: Source / Reference:

◇References & Navigation

CONFIRMATION // 理解度の確認

ACTIVE RECALL VERIFICATION

Select an answer to verify conceptual comprehension and reveal the technical rationale.

Q1

What does the notation f(n)=O(g(n))f(n) = O(g(n)) mean?

Q2

Which of the following correctly describes Big-O notation?

Q3

Is the function 6n3+2n2+3n+86n^3 + 2n^2 + 3n + 8 considered O(n4)O(n^4)?